﻿@model Moonglade.Core.PostFeature.Post

<hr />
<div class="post-slug-actions clearfix mb-2 d-print-none">
    @if (null == ViewBag.IsDraftPreview)
    {
        <div class="float-end">
            <a href="javascript:;" class="text-muted d-inline-block" data-bs-toggle="modal" data-bs-target="#qrcode-window" title="Link to show QR Code for this blog post">
                <i class="bi-qr-code-scan"></i>
            </a>
        </div>
    }
    <div>
        <section class="post-cat-tag-info">
            <ul class="d-flex flex-row flex-wrap list-unstyled ul-cat-list-desktop mb-0">
                @foreach (var item in Model.Categories)
                {
                    <li>
                        <a class="btn btn-sm btn-outline-secondary mb-1"
                           asp-page="/CategoryList"
                           asp-route-routeName="@item.RouteName.ToLower()">
                            <i class="bi-folder-fill" aria-hidden="true"></i>
                            @item.DisplayName
                        </a>
                    </li>
                }

                @if (Model.Tags.Length > 0)
                {
                    @foreach (var item in Model.Tags)
                    {
                        <li>
                            <a asp-page="/TagList"
                               asp-route-normalizedName="@item.NormalizedName" class="btn btn-sm btn-outline-secondary mb-1">
                                <i class="bi-tag-fill" aria-hidden="true"></i>
                                @item.DisplayName
                            </a>
                        </li>
                    }
                }
            </ul>
        </section>
    </div>
</div>

<div class="modal fade" id="qrcode-window" tabindex="-1" role="dialog" aria-labelledby="qrcodewindowLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <div class="modal-title" id="qrcodewindowLabel">@Model.Title</div>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
                </button>
            </div>
            <div class="modal-body">
                <div class="text-center">
                    <p class="text-center">
                        @SharedLocalizer["Scan QR Code on your phone"]
                    </p>
                    <canvas class="post-qrcode">
                    </canvas>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">@SharedLocalizer["Close"]</button>
            </div>
        </div>
    </div>
</div>